load(
    "//tools:defaults.bzl",
    "ng_module",
    "ng_test_library",
    "ng_web_test_suite",
    "sass_binary",
    "sass_library",
)

package(default_visibility = ["//visibility:public"])

ng_module(
    name = "mdc-core",
    srcs = glob(
        ["**/*.ts"],
        exclude = ["**/*.spec.ts"],
    ),
    assets = [
        ":option/option.css",
        ":option/optgroup.css",
    ] + glob(["**/*.html"]),
    module_name = "@angular/material-experimental/mdc-core",
    deps = [
        "//src/material/core",
        "@npm//@angular/common",
        "@npm//@angular/core",
        "@npm//rxjs",
    ],
)

sass_library(
    name = "mdc_core_scss_lib",
    srcs = glob(["**/_*.scss"]),
)

sass_binary(
    name = "option_scss",
    src = "option/option.scss",
    include_paths = [
        "external/npm/node_modules",
    ],
    deps = [
        "//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
        "//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
    ],
)

sass_binary(
    name = "optgroup_scss",
    src = "option/optgroup.scss",
    include_paths = [
        "external/npm/node_modules",
    ],
    deps = [
        "//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
        "//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
    ],
)

#################
#  Test targets
#################

ng_test_library(
    name = "unit_test_sources",
    srcs = glob(
        ["**/*.spec.ts"],
    ),
    deps = [
        ":mdc-core",
        "//src/cdk/keycodes",
        "//src/cdk/testing/private",
        "@npm//@angular/platform-browser",
    ],
)

ng_web_test_suite(
    name = "unit_tests",
    deps = [":unit_test_sources"],
)
